(global.webpackJsonp = global.webpackJsonp || []).push([ [ "xg_o2o/distribution/distributor" ], {
    "2c46": function(t, i, e) {
        "use strict";
        (function(t) {
            Object.defineProperty(i, "__esModule", {
                value: !0
            }), i.default = void 0;
            var e = {
                data: function() {
                    return {
                        menuShow: !1,
                        BoundingWidth: 100,
                        headerBG: "linear-gradient(to right, #56ccf2, #9CECFB)",
                        items: [],
                        items2: [],
                        distributor: {},
                        graceFullLoading: !0,
                        show1: !1,
                        cash: 0,
                        tmplIds: [],
                        submit: !1,
                        qrcode: "",
                        show3: !1,
                        show3Img: "",
                        show4: !1,
                        width: 690,
                        height: 1e3,
                        widthIn: 300,
                        heightIn: 500,
                        bgColor: "#7ACBDC",
                        bgImg: "",
                        imgSrc: null,
                        uniaccount: "",
                        isbgimg: 1,
                        showBack: !1,
                        showPersonnel: 0,
                        teckname: "",
                        teckqrcode: "",
                        teckbgimg: ""
                    };
                },
                onLoad: function() {
                    var i = getCurrentPages();
                    this.showBack = i.length > 1, this.userInfo(), this.context = t.createCanvasContext("graceCanvas"), 
                    this.initSize();
                },
                onShareAppMessage: function(t) {
                    return "button" === t.from && "personnel" === t.target.id ? {
                        title: this.distributor.persharetitle ? this.distributor.persharetitle : "诚邀加盟，共创辉煌！",
                        path: "/xg_o2o/personnel/personnel_apply?distributor=" + this.distributor.id,
                        imageUrl: this.distributor.pershareimg ? this.distributor.pershareimg : "../../static/share/share.jpg"
                    } : {
                        title: this.distributor.sharetitle ? this.distributor.sharetitle : "我发现一个好用的小程序能帮到你！",
                        path: "/xg_o2o/index/index?distributor=" + this.distributor.id,
                        imageUrl: this.distributor.shareimg ? this.distributor.shareimg : "../../static/share/share.jpg"
                    };
                },
                methods: {
                    initSize: function() {
                        this.widthIn = t.upx2px(this.width), this.heightIn = t.upx2px(this.height);
                    },
                    draw: function(i) {
                        i || (i = 1), t.showLoading({
                            title: "海报获取中"
                        }), this.step01(i);
                    },
                    step01: function(t) {
                        var i = this;
                        t || (t = 1), this.show4 = !0, this.context.setFillStyle(this.bgColor), this.context.fillRect(0, 0, this.widthIn, this.heightIn), 
                        1 != t || this.qrcode ? 1 == t && this.qrcode ? "" != this.bgImg ? this.drawBGIMG(this.bgImg, function() {
                            i.step03(1);
                        }) : this.step03(1) : 2 != t || this.teckqrcode ? 2 == t && this.teckqrcode && ("" != this.teckbgimg ? this.drawBGIMG(this.teckbgimg, function() {
                            i.step03(2);
                        }) : this.step03(2)) : this.getTeckQrcode(2) : this.getQrcode(2);
                    },
                    step03: function(i) {
                        var e, o = this;
                        e = 2 == i ? this.teckqrcode : this.qrcode, this.drawText("长按或扫一扫打开小程序", this.widthIn / 2, this.heightIn - 12, "#FFFFFF", 15, "center"), 
                        t.downloadFile({
                            url: e,
                            success: function(i) {
                                if (200 === i.statusCode) {
                                    var e = t.upx2px(160), n = (o.widthIn - e) / 2, s = o.heightIn - 40 - e;
                                    o.context.beginPath(), o.context.arc(n + e / 2, s + e / 2, e / 2, 0, 2 * Math.PI), 
                                    o.context.fill(), o.context.clip(), o.context.drawImage(i.tempFilePath, n, s, e, e), 
                                    o.drawIt();
                                } else t.hideLoading(), t.showToast({
                                    title: "海报生成失败,请联系管理员",
                                    icon: "none"
                                });
                            },
                            fail: function(t) {
                                console.log(t);
                            }
                        });
                    },
                    drawText: function(t, i, e, o, n, s) {
                        this.context.setFontSize(n), this.context.setFillStyle(o), this.context.setTextAlign(s), 
                        this.context.fillText(t, i, e);
                    },
                    drawIt: function() {
                        var i = this;
                        t.hideLoading(), this.context.draw(!0, function() {
                            t.canvasToTempFilePath({
                                x: 0,
                                y: 0,
                                width: i.widthIn,
                                height: i.heightIn,
                                destWidth: i.widthIn * wx.getSystemInfoSync().pixelRatio,
                                destHeight: i.heightIn * wx.getSystemInfoSync().pixelRatio,
                                canvasId: "graceCanvas",
                                success: function(t) {
                                    i.imgSrc = t.tempFilePath;
                                }
                            });
                        });
                    },
                    drawBGIMG: function(i, e) {
                        var o = this;
                        t.downloadFile({
                            url: i,
                            success: function(i) {
                                200 == i.statusCode && t.getImageInfo({
                                    src: i.tempFilePath,
                                    success: function(t) {
                                        var n = o.widthIn / t.width * t.height;
                                        o.context.drawImage(i.tempFilePath, 0, 0, o.widthIn, n), e();
                                    }
                                });
                            }
                        });
                    },
                    longpress: function() {
                        console.log("ok"), t.saveImageToPhotosAlbum({
                            filePath: this.imgSrc,
                            success: function() {
                                console.log("save success"), t.showToast({
                                    title: "图片已经保存到您的相册~"
                                });
                            }
                        });
                    },
                    saveQrcode: function(i) {
                        var e = this, o = i.substring(0, 8);
                        t.getSetting({
                            success: function(n) {
                                if (0 == n.authSetting["scope.writePhotosAlbum"]) t.openSetting({
                                    success: function(n) {
                                        if (1 == n.authSetting["scope.writePhotosAlbum"]) {
                                            if (console.log("重新授权"), t.showLoading({
                                                title: "保存中",
                                                mask: !0
                                            }), "https://" != o) return void t.saveImageToPhotosAlbum({
                                                filePath: i,
                                                success: function() {
                                                    t.hideLoading(), t.showToast({
                                                        title: "保存成功",
                                                        icon: "none"
                                                    }), e.show4 = !1;
                                                },
                                                fail: function(i) {
                                                    console.log(i), t.hideLoading(), t.showToast({
                                                        title: "保存失败，请稍后重试",
                                                        icon: "none"
                                                    });
                                                }
                                            });
                                            t.downloadFile({
                                                url: i,
                                                success: function(i) {
                                                    200 === i.statusCode && t.saveImageToPhotosAlbum({
                                                        filePath: i.tempFilePath,
                                                        success: function() {
                                                            t.hideLoading(), t.showToast({
                                                                title: "保存成功",
                                                                icon: "none"
                                                            });
                                                        },
                                                        fail: function() {
                                                            t.hideLoading(), t.showToast({
                                                                title: "保存失败，请稍后重试",
                                                                icon: "none"
                                                            });
                                                        }
                                                    });
                                                }
                                            });
                                        }
                                    }
                                }); else {
                                    if (t.showLoading({
                                        title: "保存中",
                                        mask: !0
                                    }), "https://" != o) return void t.saveImageToPhotosAlbum({
                                        filePath: i,
                                        success: function() {
                                            t.hideLoading(), t.showToast({
                                                title: "保存成功",
                                                icon: "none"
                                            }), e.show4 = !1;
                                        },
                                        fail: function(i) {
                                            console.log(i), t.hideLoading(), t.showToast({
                                                title: "保存失败，请稍后重试",
                                                icon: "none"
                                            });
                                        }
                                    });
                                    t.downloadFile({
                                        url: i,
                                        success: function(i) {
                                            200 === i.statusCode && t.saveImageToPhotosAlbum({
                                                filePath: i.tempFilePath,
                                                success: function() {
                                                    t.hideLoading(), t.showToast({
                                                        title: "保存成功",
                                                        icon: "none"
                                                    });
                                                },
                                                fail: function() {
                                                    t.hideLoading(), t.showToast({
                                                        title: "保存失败，请稍后重试",
                                                        icon: "none"
                                                    });
                                                }
                                            });
                                        }
                                    });
                                }
                            }
                        });
                    },
                    getQrcode: function(i) {
                        var e = this, o = this.$xSign.sign("v4distribution");
                        1 == i && t.showLoading({
                            title: "获取中"
                        }), this.$xRequest.request({
                            url: "entry/wxapp/v4distribution",
                            data: {
                                op: "qrcode",
                                xgsign: o
                            },
                            success: function(t) {
                                var o = JSON.parse(e.$Decrypt(t.data.data));
                                e.qrcode = o.img, 1 == i ? e.showDialog3(e.qrcode) : 2 == i && ("" != e.bgImg ? e.drawBGIMG(e.bgImg, function() {
                                    e.step03();
                                }) : e.step03());
                            },
                            fail: function(i) {
                                t.showModal({
                                    title: "提示",
                                    content: i.data.message,
                                    showCancel: !1,
                                    success: function(t) {
                                        t.confirm && console.log("确认");
                                    }
                                });
                            },
                            complete: function() {
                                1 == i && t.hideLoading();
                            }
                        });
                    },
                    getTeckQrcode: function(i) {
                        var e = this, o = this.$xSign.sign("v4distribution");
                        1 == i && t.showLoading({
                            title: "获取中"
                        }), this.$xRequest.request({
                            url: "entry/wxapp/v4distribution",
                            data: {
                                op: "teckqrcode",
                                xgsign: o
                            },
                            success: function(t) {
                                var o = JSON.parse(e.$Decrypt(t.data.data));
                                e.teckqrcode = o.img, 1 == i ? e.showDialog3(e.teckqrcode) : 2 == i && ("" != e.teckbgimg ? e.drawBGIMG(e.teckbgimg, function() {
                                    e.step03(2);
                                }) : e.step03(2));
                            },
                            fail: function(i) {
                                t.showModal({
                                    title: "提示",
                                    content: i.data.message,
                                    showCancel: !1,
                                    success: function(t) {
                                        t.confirm && console.log("确认");
                                    }
                                });
                            },
                            complete: function() {
                                1 == i && t.hideLoading();
                            }
                        });
                    },
                    showDialog: function() {
                        this.show1 = !0;
                    },
                    closeDialog: function() {
                        this.show1 = !1, this.cash = this.distributor.balance;
                    },
                    showDialog3: function(t) {
                        this.show3Img = t, this.show3 = !0;
                    },
                    closeDialog3: function() {
                        this.show3 = !1;
                    },
                    showDialog4: function() {
                        this.show4 = !0;
                    },
                    closeDialog4: function() {
                        this.show4 = !1;
                    },
                    clearInput: function() {
                        this.cash = "";
                    },
                    confirm: function() {
                        var i = this;
                        if (!/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/.test(this.cash)) return t.showToast({
                            title: "价格格式错误",
                            icon: "none"
                        }), !1;
                        if (this.cash - this.distributor.minimum < 0) return t.showToast({
                            title: "最低提现" + this.distributor.minimum + "元",
                            icon: "none"
                        }), !1;
                        if (this.cash - this.distributor.balance > 0) return t.showToast({
                            title: "余额不足",
                            icon: "none"
                        }), !1;
                        var e = this.$xSign.sign("v4distribution");
                        this.show1 = !1, t.showLoading({
                            title: "提交中"
                        }), this.$xRequest.request({
                            url: "entry/wxapp/v4distribution",
                            data: {
                                op: "apply",
                                cash: this.cash,
                                xgsign: e
                            },
                            success: function(e) {
                                t.hideLoading(), t.showModal({
                                    title: "提示",
                                    content: e.data.message,
                                    showCancel: !1,
                                    success: function(e) {
                                        e.confirm && (i.tmplIds.length > 0 ? wx.requestSubscribeMessage({
                                            tmplIds: i.tmplIds,
                                            complete: function(i) {
                                                t.redirectTo({
                                                    url: "./distributor"
                                                });
                                            }
                                        }) : t.redirectTo({
                                            url: "./distributor"
                                        }));
                                    },
                                    fail: function(i) {
                                        t.hideLoading(), t.showModal({
                                            title: "提示",
                                            content: i.data.message,
                                            showCancel: !1,
                                            complete: function(i) {
                                                t.redirectTo({
                                                    url: "./distributor"
                                                });
                                            }
                                        });
                                    }
                                });
                            },
                            fail: function(i) {
                                t.hideLoading(), t.showModal({
                                    title: "提示",
                                    content: i.data.message,
                                    showCancel: !1,
                                    complete: function(i) {
                                        t.redirectTo({
                                            url: "./distributor"
                                        });
                                    }
                                });
                            }
                        });
                    },
                    cashAction: function() {
                        Number(this.distributor.balance) < Number(this.distributor.minimum) ? t.showModal({
                            title: "提示",
                            content: "最低提现" + this.distributor.minimum + "元",
                            showCancel: !1,
                            confirmText: "我知道了",
                            success: function(t) {
                                t.confirm ? console.log("用户点击确定") : t.cancel && console.log("用户点击取消");
                            }
                        }) : this.show1 = !0;
                    },
                    orderlist: function(i) {
                        1 == i ? t.navigateTo({
                            url: "orderlist_per"
                        }) : t.navigateTo({
                            url: "./orderlist"
                        });
                    },
                    cashlist: function() {
                        t.navigateTo({
                            url: "./cashlist"
                        });
                    },
                    memberlist: function(i) {
                        1 == i ? t.navigateTo({
                            url: "distributor_perlist"
                        }) : t.navigateTo({
                            url: "distributor_list"
                        });
                    },
                    xgMenu: function() {
                        this.menuShow = 1 != this.menuShow;
                    },
                    menuHide: function() {
                        this.menuShow = !1;
                    },
                    userInfo: function() {
                        var i = this, e = this.$xSign.sign("v4distribution");
                        this.$xRequest.request({
                            url: "entry/wxapp/v4distribution",
                            data: {
                                xgsign: e,
                                op: "userdetail"
                            },
                            success: function(t) {
                                var e = JSON.parse(i.$Decrypt(t.data.data));
                                0 == t.data.errno && (i.graceFullLoading = !1, i.items = e.iteminfo, i.items2 = e.item2, 
                                i.distributor = e.distributor, i.cash = e.distributor.balance, i.tmplIds = e.tmplIds, 
                                i.qrcode = e.distributor.qrcode, i.bgImg = e.distributor.bgimg, i.teckbgimg = e.distributor.perbgimg, 
                                i.teckqrcode = e.distributor.teckqrcode, i.uniaccount = e.uniaccount, i.isbgimg = e.isbgimg, 
                                i.showPersonnel = e.showteck, i.teckname = e.teckname);
                            },
                            fail: function(i) {
                                t.showModal({
                                    title: "提示",
                                    content: i.data.message,
                                    showCancel: !1,
                                    success: function() {
                                        t.navigateBack({
                                            delta: 1
                                        });
                                    }
                                });
                            }
                        });
                    }
                }
            };
            i.default = e;
        }).call(this, e("543d").default);
    },
    "2cd9": function(t, i, e) {},
    5694: function(t, i, e) {
        "use strict";
        var o = e("2cd9");
        e.n(o).a;
    },
    6521: function(t, i, e) {
        "use strict";
        e.r(i);
        var o = e("2c46"), n = e.n(o);
        for (var s in o) "default" !== s && function(t) {
            e.d(i, t, function() {
                return o[t];
            });
        }(s);
        i.default = n.a;
    },
    7170: function(t, i, e) {
        "use strict";
        e.r(i);
        var o = e("729c"), n = e("6521");
        for (var s in n) "default" !== s && function(t) {
            e.d(i, t, function() {
                return n[t];
            });
        }(s);
        e("5694");
        var c = e("f0c5"), a = Object(c.a)(n.default, o.b, o.c, !1, null, null, null, !1, o.a, void 0);
        i.default = a.exports;
    },
    "729c": function(t, i, e) {
        "use strict";
        e.d(i, "b", function() {
            return n;
        }), e.d(i, "c", function() {
            return s;
        }), e.d(i, "a", function() {
            return o;
        });
        var o = {
            gracePage: function() {
                return e.e("graceUI/components/gracePage").then(e.bind(null, "1915"));
            },
            graceFullLoading: function() {
                return e.e("graceUI/components/graceFullLoading").then(e.bind(null, "7669"));
            },
            graceBoxBanner: function() {
                return e.e("graceUI/components/graceBoxBanner").then(e.bind(null, "b5e7"));
            },
            graceDialog: function() {
                return e.e("graceUI/components/graceDialog").then(e.bind(null, "8d15"));
            }
        }, n = function() {
            this.$createElement, this._self._c;
        }, s = [];
    },
    a05d: function(t, i, e) {
        "use strict";
        (function(t) {
            function i(t) {
                return t && t.__esModule ? t : {
                    default: t
                };
            }
            e("4e1e"), i(e("66fd")), t(i(e("7170")).default);
        }).call(this, e("543d").createPage);
    }
}, [ [ "a05d", "common/runtime", "common/vendor" ] ] ]);